// pages/member/orderRecord.js
var base = require('../../conf.js')
Page({
  data: {
    userlist: [],
    imgPath: base.imgPath,
  },
  onLoad(){
    this.getConsume()
  },
  getConsume:function(){
    var self = this;
    wx.request({
      url: base.url + '/consume',
      method: 'get',
      header: {
        "Content-Type": "application/json;charset=UTF-8",
        'userToken': base.token_Date
      },
      success: function (res) {
        console.log(res.data.data)
        var userlist = self.getItem(res.data.data)
        self.setData({
          userlist: userlist
        })
      }
    })
  },
  getItem(Item) {
    for (var i = 0; i < Item.length; ++i) {
      Item[i].img = Item[i].img.split(",")[0]
    }
    return Item
  },
  orderDetail: function (e) {
    var oid = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/pages/member/orderDetail' + '?' + 'oid=' + oid,
    })
  },
  toOrder: function () {
    wx.navigateTo({
      url: "/pages/home-page/order"
    })
  }
})